<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>购买产品测试</title>
    <script src="https://code.jquery.com/jquery-3.2.1.min.js" th:src="@{/js/jquery-3.2.1.min.js}"></script>
    <script>
        $(function () {
            $("#btn-test").click(function() {
                var number = $('#number').val()
                for (var i=0; i<number; i++) {
                    test()
                }
            })
        })

        test = function() {
            var params = {
                userId: 1,
                productId: 1,
                quantity: 1
            }
            $.post("./orders", params, function (result) {
                console.log(result.message)
            })
        }
    </script>
</head>
<body style="text-align: center;">
<h1>抢购产品测试</h1>

<br>
<input type="number" id="number" placeholder="测试次数" value="1"><br><br>
<input type="button" id="btn-test" value="开始测试" style="height:100px; width:100px; font-size: 72px; cursor:pointer;">
</body>
</html>